<template>
	<view class="wrap">
		<rich-text :nodes="content"></rich-text>
	</view>
</template>

<script>
	import $api from '@/common/js/api.js'
	import {mapState} from 'vuex'
	export default{
		data(){
			return {
				content:"", //文章内容
			}
		},
		computed:{
			...mapState("user", ["configData"])
		},
		async onLoad(options) {
			let res = await $api.getConfigInfo()
			// console.log("配置i细腻",res)
			if(res.code === 1 && res.data){
				
				let {title} = options
				uni.setNavigationBarTitle({
					title:this.$t(title)
				})
				let language = uni.getStorageSync("language")
				let tag = title.split(".")[1]
				let obj = {
					cn:{ //中文
						protocol:"jiaoyizhidu_cn", //用戶協議
						privacy:"privacy_policy_ch", //隱私政策
						company:"guanyuwomen_ch" //公司
					},
					en:{ //英文
						protocol:"jiaoyizhidu_en", //用戶協議
						privacy:"privacy_policy_en", //隱私政策
						company:"guanyuwomen_en", //公司
					},
					kro:{ //韓文
						protocol:"jiaoyizhidu_kro", //用戶協議
						privacy:"privacy_policy_kro", //隱私政策
						company:"guanyuwomen_kro", //公司
					}
				}
				let name = obj[language][tag]
				
				let config = res.data.find(item=>{
					return item.name === name
				})
				
				
				this.content = config.value
			}
			
			

			// 獲取文章内容
		},
		methods:{
			
		}
	}
</script>

<style lang="scss">
	.wrap{
		color: #fff;
		padding: 24rpx;
		box-sizing: border-box;
	}
	img{
		width: 100%;
	}
</style>